package com.znyj.cloud.device.task;

/**
 * Created by gaoliwei02 on 17/6/19.
 */
//@Component
//public class SqlTempPool {
//
//    private static final Logger logger = Logger.getLogger(SqlTempPool.class);
//
//    public static final Queue<BaseEntity> sqlReportQueue = new LinkedList<BaseEntity>();
//    public static final Queue<BaseEntity> sqlUpdateOnlineQueue = new LinkedList<BaseEntity>();
//
//    @Resource
//    private ThreadPoolTaskExecutor taskExecutor;
//
//    @Scheduled(cron = "0/1 * * * * ?")
//    public void SqlReportTempPool() {
//
//        int sizeOfQueue = sqlReportQueue.size();
//        if (sizeOfQueue > SysConstant.ONE_TIME_MAX_SQL_EXCUTE) {
//            sizeOfQueue = SysConstant.ONE_TIME_MAX_SQL_EXCUTE;
//        }
//
//        if (sizeOfQueue > 10) {
//            logger.error(CheckUtil.monitorReport(SysConstant.ERROR_CODE.SQL_POOL_WARN, "", (long)sqlReportQueue.size()));
//        }
//
//        for (int i = 0; i < sizeOfQueue; i++) {
//            CdbReportEntity cdbReportEntity = (CdbReportEntity) sqlReportQueue.poll();
//            taskExecutor.executeReceive(new ReportReceiveAsyncTask(cdbReportEntity, SysConstant.CDB_OP.UPDATE_REPORT));
//        }
//    }
////    @Scheduled(cron = "0/1 * * * * ?")
////    public void SqlUpdateOnlineTempPool() {
////        int sizeOfQueue = sqlUpdateOnlineQueue.size();
////        if (sizeOfQueue > SysConstant.ONE_TIME_MAX_SQL_EXCUTE) {
////            sizeOfQueue = SysConstant.ONE_TIME_MAX_SQL_EXCUTE;
////        }
////        logger.error("++SqlUpdateOnlineTempPool++++sizeOfQueue:{} {}", sizeOfQueue, sqlReportQueue.size());
////
////        for (int i = 0; i < sizeOfQueue; i++) {
////            taskExecutor.executeReceive(new InfoAsyncTask((CdbInfoEntity) sqlUpdateOnlineQueue.poll(), SysConstant.CDB_OP.UPDATE_ONLINE_INFO));
////        }
////    }
//}
